<!--
 * @Author: your name
 * @Date: 2021-04-18 17:30:44
 * @LastEditTime: 2021-04-18 20:36:19
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \w1811-a-wang-xiaotong\day1\myapp\src\views\index.vue
-->
<template>
  <div class="home">
    <div class="header">
      <van-icon name="search" />
      <input type="text" placeholder="历史的拐点">
      <van-icon name="plus" />
    </div>
    <div class="main">
      <router-view />
    </div>
    <div class="footer">
      <div v-for="(item,index) in arr" :key="index">
        <router-link :to="item.path">
          <van-icon :name="item.icon" />
          {{item.name}}
        </router-link>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  created() {
    // console.log(this.$router.options.routes[0].children)
    this.arr = this.$router.options.routes[0].children;
  },
  data() {
    return {
      arr: []
    };
  }
};
</script>
<style lang="scss">
* {
  margin: 0;
  padding: 0;
  list-style: none;
  box-sizing: border-box;
}
html,body,#app{
  width: 100%;
  height: 100%;
}
.home{
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.header{
  width: 90%;
  height: auto;
  background-color: #ccc;
  margin: 10px auto;
  padding: 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
}
.header input{
  flex: 1;
  background: #ccc;
  border: none;
  margin-left: 10px;
}
.footer{
  width: 100%;
  height: auto;
  padding: 10px;
  border-top: 1px solid #ccc;
  background-color: #ececec;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.main{
  flex:1;
  overflow-y: auto;
}
</style>